using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace hoshimiTestBench
{
    public class MyBitmap
    {
        public Bitmap bitmap;
        Graphics g;
        int pixelWidth;
        int pixelHeight;
        private int height;

        public int Height
        {
            get { return bitmap.Height / pixelHeight; }

        }

        private int width;

        public int Width
        {
            get { return bitmap.Width / pixelWidth; }
           
        }
	

        public MyBitmap(Bitmap bmp, int pixelWidth, int pixelHeight)
        {
            this.pixelHeight = pixelHeight;
            this.pixelWidth = pixelWidth;
            bitmap = new Bitmap(bmp.Width * pixelWidth, bmp.Height * pixelHeight); 
            g = Graphics.FromImage(bitmap);
            
            for (int y = 0; y < bmp.Height; y++)
            {
                for (int x = 0; x < bmp.Width; x++)
                {
                    SetPixel(x,y,bmp.GetPixel(x,y));                    
                }
            }
        }
        public void SetPixel(int x, int y, Color c)
        {
            g.FillRectangle(new SolidBrush(c), x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight);
        }
        public Color GetPixel(int x, int y)
        {
            return bitmap.GetPixel(x * pixelWidth, y * pixelHeight);
        }
        public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
        {
            g.DrawLine(pen, x1 * pixelWidth + 1, y1 * pixelHeight + 1,
                            x2 * pixelWidth + 1, y2 * pixelHeight + 1);
        }
    }
}
